<template>
	<view class="container">
		<u-no-network></u-no-network>
		<view class="tudndui display_flex flex_start">
			<view class="">
				<image class="touxiang" src="/static/img/s14.png" mode=""></image>
			</view>
			<view class="tuandui" @click="clickMenu('/pages/index/tuandui/tuandui')">
				<view class="" style="text-align: left;">{{name}}的团队</view>
				<view class="" style="padding-top: 20upx;text-align: left;">
					<view class="">团队总人数: {{tameinfo.teamCount}}</view>
					<view class="" v-if="tameinfo.teamCoin">团队总{{tameinfo.teamCoin[0].coin_name}} : {{tameinfo.teamCoin[0].coin_value}}</view>
					<view class="" v-if="tameinfo.teamCoin">团队总{{tameinfo.teamCoin[1].coin_name}} : {{tameinfo.teamCoin[1].coin_value}}</view>
				</view>
			</view>
		</view>
		<view class="jiange"></view>
		<view class="xiaji" style="color: #555555;" v-if="tameinfo.childList">
			下级用户({{tameinfo.childList.length}})
			<view class="box"  v-for="(item,index) in tameinfo.childList" :key="index">
				<view class="shang display_flex flex_between">
					<view class="shangconteny display_flex flex_start">
						<image src="/static/img/hader.png" mode=""></image>
						<text style="position: relative;top: -6upx;">{{item.user_nick_name}}</text>
					</view>
					<view class="jiayi font_size_26" style="color: #64C100;">
						{{item.wallet[0].coin_value}} {{tameinfo.teamCoin[0].coin_name}}
					</view>
				</view>
				<!-- FF775F  FF5050 -->
				<view class="xia display_flex flex_between">
					<view class="zongshu font_size_28" >
						{{item.wallet[0].create_time}}
					</view>
					<view class="display_flex flex_start" style="color: #64C100;">
						{{item.wallet[1].coin_value}} {{tameinfo.teamCoin[1].coin_name}}
					</view>
				</view>
				
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:'',
				tameinfo:'',
				boxList:[
					{icon:'',id:"USDT",yue:'1521.00'},
					{icon:'',id:"DOGZ",yue:'1522.00'},
					{icon:'',id:"SHIB",yue:'1523.00'},
					{icon:'',id:"AKITA",yue:'1524.00'},
				],
			}
		},
		onLoad(e) {
			this.name = e.name
		},
		onShow() {
			this.myteam()
		},
		methods: {
			jiequ(num, decimal) {
				num = num.toString()
				let index = num.indexOf('.')
				if (index !== -1) {
					num = num.substring(0, decimal + index + 1)
				} else {
					num = num.substring(0)
				}
				return parseFloat(num).toFixed(decimal)
			},
			// 初始化方法
			async myteam (){
				let data = {
					user_id: uni.getStorageSync('rescodeUserInfo').user_id
				}
				const res = await this.$appserve.myteam(data);
				//console.log(res)
				res.data.teamCoin.forEach((item)=>{
					item.coin_value = this.jiequ(item.coin_value,2)
				})
				res.data.childList.forEach((item)=>{
					if(item.wallet.length>0){
						item.wallet.forEach((i)=>{
							i.coin_value = this.jiequ(i.coin_value,2)
						})
					}
				})
				this.tameinfo= res.data
				
			},
		}
	}
</script>
<style>
	page {
		background-color: #fff !important;
	}
</style>
<style scoped lang="less">
	.xiaji{
		padding: 30upx;
		
	}
	.tuandui {
		color: #fff;
		padding-top: 60upx;

		image {
			width: 28upx;
			height: 30upx;
		}
	}

	.touxiang {
		width: 128upx;
		height: 128upx;
		padding: 60upx 30upx 0 60upx;
	}

	.tudndui {
		background: url("") no-repeat;
		background-size: 100% 100%;
		height: 320upx;
		padding: 0.1px;
		position: relative;
		margin: 0 auto;
		text-align: center;
	}

	.jiange {
		width: 100%;
		height: 20upx;
		background-color: #F7F7F7;
		margin-top: -2upx;
	}
	
	.zongshu{
		color: #A4A4A4 ;
	}
	.box{
		background: #FFFFFF;
		border-radius: 12px;
		padding: 20upx;
		margin: 0 auto;
		border-bottom: 2upx solid #EDEDED;
	}
	.box view{
		line-height: 60upx;
	}
	.biaoti{
		font-weight: 600;
	}
	.shangconteny{
		line-height: 50upx;
	}
	
	.shangconteny image{
		width: 50upx;
		height: 50upx;
		line-height: 50upx;
		margin-right: 20upx;
		
	}
	.jiayi{
		color: #A4A4A4;
	}
</style>
